home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / Gadgets.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  5.8 KB  |  213 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Gadgets.mod $
  4.   Description: Interface to the colorwheel, tapedeck and gradientslider
  5.                gadgets.
  6.  
  7.    Created by: fjc (Frank Copeland)
  8.     $Revision: 3.6 $
  9.       $Author: fjc $
  10.         $Date: 1995/01/26 02:39:55 $
  11.  
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1992-1993 Commodore-Amiga Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. *************************************************************************)
  22.  
  23. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  24. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  25. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  26.  
  27. MODULE [2] Gadgets;
  28.  
  29. IMPORT SYS := SYSTEM, Kernel, e := Exec, u := Utility;
  30.  
  31. (* !!! ATTENTION !!!
  32.  * You have to call OpenColorWheel() and check it's result before
  33.  * using any of the colorwheel's procedures. The colorwheel is not
  34.  * opened automatically to save memory.
  35.  *)
  36.  
  37. (*
  38. **      $VER: gradientslider.h 39.1 (18.6.92)
  39. **
  40. **      Definitions for the gradientslider BOOPSI class
  41. *)
  42.  
  43. (************************************************************************)
  44.  
  45. CONST
  46.  
  47.   gradDummy *      = u.user + 005000000H;
  48.   gradMaxVal *     = gradDummy+1;  (* max value of slider         *)
  49.   gradCurVal *     = gradDummy+2;  (* current value of slider     *)
  50.   gradSkipVal *    = gradDummy+3;  (* "body click" move amount    *)
  51.   gradKnobPixels * = gradDummy+4;  (* size of knob in pixels      *)
  52.   gradPenArray *   = gradDummy+5;  (* pen colors                  *)
  53.  
  54.  
  55. (************************************************************************)
  56.  
  57. (*
  58. **      $VER: tapedeck.h 40.0 (12.3.93)
  59. **
  60. **      Definitions for the tapedeck BOOPSI class
  61. *)
  62.  
  63. (************************************************************************)
  64.  
  65. CONST
  66.  
  67.   tdeckDummy *     = u.user + 005000000H;
  68.   tdeckMode *      = tdeckDummy + 1;
  69.   tdeckPaused *    = tdeckDummy + 2;
  70.  
  71.   tdeckTape *      = tdeckDummy + 3;
  72.     (* (BOOL) Indicate whether tapedeck or animation controls.  Defaults
  73.      * to FALSE. *)
  74.  
  75.   tdeckFrames *    = tdeckDummy + 11;
  76.     (* (LONG) Number of frames in animation.  Only valid when using
  77.      * animation controls. *)
  78.  
  79.   tdeckCurrentframe * = tdeckDummy + 12;
  80.     (* (LONG) Current frame.  Only valid when using animation controls. *)
  81.  
  82. (************************************************************************)
  83.  
  84. CONST
  85.  
  86. (* Possible values for tdeckMode *)
  87.   butRewind *  = 0;
  88.   butPlay *    = 1;
  89.   butForward * = 2;
  90.   butStop *    = 3;
  91.   butPause *   = 4;
  92.   butBegin *   = 5;
  93.   butFrame *   = 6;
  94.   butEnd *     = 7;
  95.  
  96. (***********************************************************************)
  97.  
  98. (*
  99. **      $VER: colorwheel.h 39.2 (22.6.92)
  100. **
  101. **      Definitions for the colorwheel BOOPSI class
  102. *)
  103.  
  104. (***********************************************************************)
  105.  
  106. TYPE
  107.  
  108. (* For use with the WHEEL_HSB tag *)
  109.   ColorWheelHSBPtr * = POINTER TO ColorWheelHSB;
  110.   ColorWheelHSB * = RECORD
  111.     hue * : e.ULONG;
  112.     saturation * : e.ULONG;
  113.     brightness * : e.ULONG;
  114.   END;
  115.  
  116. (* For use with the WHEEL_RGB tag *)
  117.   ColorWheelRGBPtr * = POINTER TO ColorWheelRGB;
  118.   ColorWheelRGB * = RECORD
  119.     red * : e.ULONG;
  120.     green * : e.ULONG;
  121.     blue * : e.ULONG;
  122.   END;
  123.  
  124.  
  125. (***********************************************************************)
  126.  
  127. CONST
  128.  
  129.   wheelDummy *          = u.user + 004000000H;
  130.   wheelHue *            = wheelDummy+1;  (* set/get Hue               *)
  131.   wheelSaturation *     = wheelDummy+2;  (* set/get Saturation        *)
  132.   wheelBrightness *     = wheelDummy+3;  (* set/get Brightness        *)
  133.   wheelHSB *            = wheelDummy+4;  (* set/get ColorWheelHSB     *)
  134.   wheelRed *            = wheelDummy+5;  (* set/get Red               *)
  135.   wheelGreen *          = wheelDummy+6;  (* set/get Green             *)
  136.   wheelBlue *           = wheelDummy+7;  (* set/get Blue              *)
  137.   wheelRGB *            = wheelDummy+8;  (* set/get ColorWheelRGB     *)
  138.   wheelScreen *         = wheelDummy+9;  (* init screen/enviroment    *)
  139.   wheelAbbrv *          = wheelDummy+10; (* "GCBMRY" if English       *)
  140.   wheelDonation *       = wheelDummy+11; (* colors donated by app     *)
  141.   wheelBevelBox *       = wheelDummy+12; (* inside a bevel box        *)
  142.   wheelGradientSlider * = wheelDummy+13; (* attached gradient slider  *)
  143.   wheelMaxPens *        = wheelDummy+14; (* max # of pens to allocate *)
  144.  
  145.  
  146. (*-- Library Base variable --------------------------------------------*)
  147.  
  148. CONST
  149.  
  150.   colorWheelName * = "colorwheel.library";
  151.  
  152. VAR
  153.  
  154.   cwBase* : e.LibraryPtr;
  155.   cwOpenCount : LONGINT; (* OpenLib() counter *)
  156.  
  157.  
  158. (*-- Library Functions ------------------------------------------------*)
  159.  
  160. (*
  161. **      $VER: colorwheel_protos.h 39.1 (21.7.92)
  162. *)
  163.  
  164. (*--- functions in V39 or higher (Release 3) ---*)
  165.  
  166. (* Public entries *)
  167.  
  168. PROCEDURE ConvertHSBToRGB* [cwBase,-30]
  169.   ( VAR hsb [8] : ColorWheelHSB;
  170.     VAR rgb [9] : ColorWheelRGB );
  171.  
  172. PROCEDURE ConvertRGBToHSB* [cwBase,-36]
  173.   ( VAR rgb [8] : ColorWheelRGB;
  174.     VAR hsb [9] : ColorWheelHSB );
  175.  
  176. (*-- Library Base variable --------------------------------------------*)
  177.  
  178. <*$ LongVars- *>
  179.  
  180. (*-----------------------------------*)
  181. PROCEDURE* [0] CloseCW (VAR rc : LONGINT);
  182.  
  183. BEGIN (* CloseCW *)
  184.   IF cwBase # NIL THEN e.CloseLibrary (cwBase) END
  185. END CloseCW;
  186.  
  187. PROCEDURE [0] OpenColorWheel * (): BOOLEAN;
  188. BEGIN
  189.   IF cwOpenCount = 0 THEN (* not opened *)
  190.     cwBase := e.OpenLibrary(colorWheelName,39);
  191.   END;
  192.   IF cwBase # NIL THEN
  193.     INC(cwOpenCount);
  194.     RETURN TRUE;
  195.   END;
  196.   RETURN FALSE;
  197. END OpenColorWheel;
  198.  
  199. PROCEDURE [0] CloseColorWheel * ();
  200. BEGIN
  201.   IF cwOpenCount > 0 THEN
  202.     DEC(cwOpenCount);
  203.     IF cwOpenCount = 0 THEN
  204.       e.CloseLibrary(cwBase); cwBase := NIL;
  205.     END;
  206.   END;
  207. END CloseColorWheel;
  208.  
  209. BEGIN
  210.   cwOpenCount := 0; cwBase := NIL;
  211.   Kernel.SetCleanup (CloseCW)
  212. END Gadgets.
  213.